home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWDebug / Sources / FWGlue.asm < prev    next >
Encoding:
Assembly Source File  |  1996-04-25  |  2.4 KB  |  126 lines  |  [TEXT/MPS ]

  1. ;========================================================================================
  2. ;
  3. ;    File:                FWGlue.asm
  4. ;    Release Version:    $ ODF 1 $
  5. ;
  6. ;    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. ;
  8. ;========================================================================================
  9.  
  10.     LOCALS            ; Yes, we want local symbols on (those prefixed with a @@)
  11.     Model    Large    ; Large memory model
  12.     .286            ; Enable i286 instructions for things like "PUSHALL"
  13.     
  14.     %NOINCL
  15.     include    macros.asm
  16.     
  17.     c_name    _trace_pro_f
  18.     c_name    _trace_epi_f
  19.  
  20.     public _trace_pro_f
  21.     public _trace_epi_f
  22.         
  23.         extrn ?TraceIn@_FW_CTraceRuntime@@TAXXZ:far        ; _FW_CTraceRuntime::TraceIn()
  24.         extrn ?TraceOut@_FW_CTraceRuntime@@TAXXZ:far    ; _FW_CTraceRuntime::TraceOut()
  25.  
  26.         begdata
  27.         
  28. ;========================================================================================
  29. ; We might call a tracer that's itself compiled with tracing on.  To prevent
  30. ; infinite loops, stack faults, nuclear disasters, etc., we have this little
  31. ; varibale here that we use as a semaphore
  32. ;========================================================================================
  33.         
  34. nTraceNesting dw 0
  35.         
  36.         enddata
  37.  
  38.         begcode    Trace
  39.         
  40. PushAll macro
  41.         pusha
  42.         pushf
  43.         push ES
  44.         push DS
  45. endm
  46.  
  47. PopAll macro
  48.         pop DS
  49.         pop ES
  50.         popf
  51.         popa
  52. endm
  53.         
  54. ;========================================================================================
  55. ; _trace_pro_f
  56. ;
  57. ;    Called by SymC++ when a function is entered.
  58. ;========================================================================================
  59.  
  60. func _trace_pro_f
  61.  
  62.         WINENTER
  63.  
  64.         PushAll
  65.         
  66.         mov    AX, DGROUP
  67.         mov DS, AX
  68.         
  69.         inc nTraceNesting
  70.         
  71.         cmp nTraceNesting, 1
  72.         jne _pro_exit
  73.         
  74.         call ?TraceIn@_FW_CTraceRuntime@@TAXXZ
  75.  
  76.         mov    AX, DGROUP
  77.         mov DS, AX
  78.  
  79. _pro_exit:
  80.         dec    nTraceNesting
  81.         
  82.         PopAll
  83.  
  84.         WINLEAVE
  85.         retf
  86.         
  87. c_endp _trace_pro_f
  88.  
  89. ;========================================================================================
  90. ; @_trace_epi_f()
  91. ;
  92. ;    Called by SymC++ when a function is exited.
  93. ;========================================================================================
  94.  
  95. func _trace_epi_f
  96.  
  97.         WINENTER
  98.  
  99.         PushAll
  100.  
  101.         mov    AX, DGROUP
  102.         mov DS, AX
  103.         
  104.         inc nTraceNesting
  105.         
  106.         cmp nTraceNesting, 1
  107.         jne _epi_exit
  108.     
  109.         call ?TraceOut@_FW_CTraceRuntime@@TAXXZ
  110.  
  111.         mov    AX, DGROUP
  112.         mov DS, AX
  113.  
  114. _epi_exit:
  115.         dec    nTraceNesting
  116.         
  117.         PopAll
  118.         
  119.         WINLEAVE
  120.         retf
  121.         
  122. c_endp _trace_epi_f
  123.  
  124.         endcode    Trace
  125.         end
  126.